package com.quwan.common.enums;

/**
 * @author lt
 * @Date 2022/1/10 12:42 下午
 */
public enum MemberStatusEnum {
    DISABLED("删除", 0),
    NORMAL("正常", 1),
    LOGOUT("注销", 2);

    private String msg;
    private Integer code;

    private MemberStatusEnum(String msg, int code) {
        this.msg = msg;
        this.code = code;
    }
    public static String getMsgByCode(Byte code){
        MemberStatusEnum[] enums = MemberStatusEnum.values();
        for (MemberStatusEnum meMberStatusEnum :enums){
            if(meMberStatusEnum.getCode().equals(code)){
                return meMberStatusEnum.getMsg();
            }
        }
        return "";
    }

    public static boolean isValidCode(Byte code) {
        for (MemberStatusEnum meMberStatusEnum : MemberStatusEnum.values()) {
            if (code.equals(meMberStatusEnum.getCode())) {
                return true;
            }
        }
        return false;
    }

    public String getMsg() {
        return msg;
    }

    public Integer getCode() {
        return code;
    }
}
